package com.gouaixin.bee.beeframework2.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gouaixin.bee.beeframework2.bean.ZhenxinhuaFriend;
import com.gouaixin.bee.beeframework2.tool.mLog;
import com.lidroid.xutils.BitmapUtils;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/3/30.
 */
public class ZhenxinhuaFriendAdapter extends BaseAdapter {

    Context context;
    List<ZhenxinhuaFriend> datas = new ArrayList<ZhenxinhuaFriend>();
    ImageLoader imageLoader;

    public ZhenxinhuaFriendAdapter(Context context) {
        this.context = context;
        imageLoader=ImageLoader.getInstance();
    }

    public void setData(List<ZhenxinhuaFriend> data) {
        datas = data;
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

//        final ImageView mView = (ImageView) LayoutInflater.from(context).inflate(R.layout.grideview_image,
//                null);
        final TextView mView = new TextView(context);

        AbsListView.LayoutParams param = new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                160);
        mView.setLayoutParams(param);

        if (datas.size() != 0) {
            String url = datas.get(position).getJicon();
            mLog.e("真心话好友图片url:" + url);

            BitmapUtils bitmapUtils=new BitmapUtils(context);
            bitmapUtils.display(mView,url);

        }


        return mView;
    }
}
